import multiprocessing
import time

def square_number(n):
    time.sleep(0.5)
    result = n * n
    print(f"{n} 's Square is {result}")
    return result

if __name__ == "__main__":
    with multiprocessing.Pool(processes=4)  as pool:
        results = []
        for i in range(10):
            result = pool.apply_async(square_number, args=(i, ))
            results.append(result)
        # 按顺序存储每一个返回的结果，避免乱序
        output = [result.get() for result in results]

    
    print(output)